Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure create app to make it easier to upgrade deps #477

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

ericanderson
Copy link
Member

@ericanderson ericanderson commented Jul 11, 2024

Changes:

  • Re-enable diff contents output when things don't match so its easier to debug whats wrong
  • Shift each template for create-app to its own package
  • Use codegen to package the template contents into a single variable so its easy to import from @osdk/create-app
  • Use the package.json (not just the package.json.hbs) for the dependencies of the template. This allows dependabot to update the relevant values, without us needing to update the template by hand.

Thankfully, the existence of the examples directory to validate the output of the generators means I was able to ensure this did not change the output!

Note for reviewer:

  • All of the @osdk/create-app.template.* folders are just:
    • migration of packages/create-app/templates/X -> packages/create-app.template.X (except X changed slightly).
    • removal of concrete dependencies from the templates/package.json.hbs file and put them in package.json
    • boilerplate
  • All the real meat of the change exists in packages/create-app/src and the new package that has the codegen packages/create-app.template-packager.

`;
},
},
}),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unified README's.

@@ -5,7 +5,7 @@
"editor.defaultFormatter": "dprint.dprint"
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
"editor.defaultFormatter": "dprint.dprint"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how this got changed but its doing the wrong formatting until now.

import * as fs from "node:fs/promises";
import * as path from "node:path";
import serialize from "serialize-javascript";

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code gen for each @osdk/create-app.template.*/src/generatedNoCheck/

@@ -79,16 +79,38 @@ export async function run(

consola.info(`Copying files into project directory`);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Begin actual meat change for the template generation. Just writes from a map instead of cp from a directory.

@@ -141,12 +142,49 @@ async function checkExamples(
`Found ${compareResult.differences} differences in ${exampleId} please generate examples again.`,
);
consola.error(compareResult.diffSet?.filter(d => d.state !== "equal"));

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Output proper diffs when things don't match

@ericanderson ericanderson force-pushed the ea.restructure-create-app branch from acff9d6 to af052e0 Compare July 18, 2024 13:38
@ericanderson ericanderson force-pushed the ea.restructure-create-app branch from af052e0 to 5b2ffc7 Compare July 18, 2024 13:54
@ericanderson ericanderson merged commit 280e70c into main Jul 18, 2024
6 checks passed
@ericanderson ericanderson deleted the ea.restructure-create-app branch July 18, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants